import request from '@/utils/request'

// 获取完整权限树
export function completePermission() {
  return request({
    url: '/permission/getCompletePermission',
    method: 'post'
  })
}

// 根据角色id获取以获得权限 roleId
export function permissionIdListByRoleId(data) {
  return request({
    url: '/permission/getPermissionIdListByRoleId',
    method: 'post',
    data
  })
}

// 新增角色
export function saveRoleData(data) {
  return request({
    url: '/permission/saveRoleData',
    method: 'post',
    data
  })
}

// 修改角色
export function updateRoleData(data) {
  return request({
    url: '/permission/updateRoleData',
    method: 'post',
    data
  })
}

// 删除角色 roleId
export function deleteRoleData(data) {
  return request({
    url: '/permission/deleteRoleData',
    method: 'post',
    data
  })
}

// 列表数据
export function listRoleData(data) {
  return request({
    url: '/permission/listRoleData',
    method: 'post',
    data
  })
}

// 配置权限(保存)
export function configPermission(data) {
  return request({
    url: '/permission/configPermission',
    method: 'post',
    data
  })
}

// 根据等级加载上级角色 roleId
export function upperRoleByLevel(data) {
  return request({
    url: '/permission/getUpperRoleByLevel',
    method: 'post',
    data
  })
}

// 获取用户所拥有权限
export function permissionByUser(data) {
  return request({
    url: '/permission/getPermissionByUser',
    method: 'post',
    data
  })
}

